package com.object;

import java.util.Objects;

/**
 * @Author WaveHi
 * @Date 4/8/2021 上午 10:39
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description 测试同String()方法
 */
public class ToStringDemo {

    public static void main(String[] args) {

        //获取学生
        Student s1 = new Student("Ton",12);

        //输出学生信息
        System.out.println(s1);

        Objects.equals(1,2);



    }



}

//学生类
class Student {

    private String name;//学生姓名
    private int age;//学生年龄

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Student() {
    }

    public String toString() {

        return "Student[" + "name = " +name + ",age = " + age + "]";

    }

}

